package com.simen.downloader;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;

import com.simen.downloader.listener.DownloadListener;

/**
 * Created by zhangming on 16/5/11.
 */
public class DownloadBroadcastReceiver extends BroadcastReceiver {

//    public final static String ACTION

    private DownloadListener downloadListener;

    public DownloadBroadcastReceiver(DownloadListener downloadListener) {
        this.downloadListener = downloadListener;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if (downloadListener == null) {
            return;
        }
    }

    public void registerReceiver(Context context) {
        IntentFilter intentFilter = new IntentFilter();
        LocalBroadcastManager.getInstance(context.getApplicationContext()).registerReceiver(this, intentFilter);
    }

    public void unregisterReceiver(Context context) {
        LocalBroadcastManager.getInstance(context.getApplicationContext()).unregisterReceiver(this);
    }
}
